package general_task;

public class TruncatedStateStructure {
	
		private int size;
		private int state[][];
		
		
		public TruncatedStateStructure(int size, int[][] state) {
			super();
			this.size = size;
			this.state = state;
		}

		int getSize(){
			return size;
		}
		
		int[][] getState(){
			return state;
		}

		public String toString(){
			String aux="[";
			for(int i=0;i<size;i++){
				aux+="("+state[0][i]+","+state[1][i]+")";
			}
			return aux+="]\n";
		}

		public TruncatedStateStructure cloneWithout(int remove) {
			int[][] new_state=new int[2][size-1];
			int delta=0;
			for(int i=0;i<size;i++){
				if(i==remove){
					delta=1;
				} else {
					new_state[0][i-delta]=state[0][i];
					new_state[1][i-delta]=state[1][i];
				}
			}
			
			return new TruncatedStateStructure(size-1,new_state);
		}

		public TruncatedStateStructure cloneAdding(int new_atribute) {
			int[][] new_state=new int[2][size+1];
			for(int i=0;i<size;i++){
				new_state[0][i]=state[0][i];
				new_state[1][i]=state[1][i];
			}
			new_state[0][size]=new_atribute;
			new_state[1][size]=0;
			return new TruncatedStateStructure(size+1,new_state);
		}

}